const express=require("express");
const app=express();
const port=3001;

app.post("/user",function(req,res){
    res.json({code:201,msg:"http:post请求"});
});
app.put("/user/1",function(req,res){
    res.json({code:204,msg:"http:put请求"});
});
app.patch("/user/1",function(req,res){
    res.json({code:201,msg:"http:patch请求"});
});
app.delete("/user/1",function(req,res){
    res.json({code:200,msg:"http:delete请求"});
});
app.all("/secret",function(req,res,next){
    console.log("访问/secret...");
    res.json({code:200,msg:`All请求,响应http路由方法${req.method}`});
});
app.listen(port,function(){
    console.log(`MyApp访问地址:http://127.0.0.1:${port}`);
});